// CherryMerry ( Mikhail Tomilenko ), Reverse Entertainment, 2021-2024

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include <GameplayTagContainer.h>
#include "PlayerCombatManager.generated.h"


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class NIFESTGAME_API UPlayerCombatManager : public UActorComponent
{
	GENERATED_BODY()

public:	
	UPlayerCombatManager();

protected:
	FGameplayTagContainer CombatTags;

	virtual void BeginPlay() override;

	bool bCanUseUltimate;
	bool bCanUseAbility;
	bool bCanAttack;

	TSubclassOf<UDamageType> UltimateDamageType;
	TSubclassOf<UDamageType> AbilityDamageType;
	TSubclassOf<UDamageType> AttackDamageType;

	FTimerHandle UltimateTimerHandle;
	FTimerHandle AbilityTimerHandle;
	FTimerHandle AttackTimerHandle;

	UFUNCTION(BlueprintCallable)
	virtual void AddProgressToUltimate(float ProgressToAdd);

	virtual void UpdateUltimate();
	virtual void UpdateAbility();
	virtual void UpdateAttack();

public:	
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	float UltimateProgress;
	float MinUltimateDamage;
	float MaxUltimateDamage;

	float MinAbilityDamage;
	float MaxAbilityDamage;

	float MinAttackDamage;
	float MaxAttackDamage;

	bool bBlockingDamage;

	virtual void UseUltimate();

	virtual void UseAbility();

	virtual void Attack();

	virtual void BlockIncomingDamage();
	virtual void StopBlockIncomingDamage();
};
